<?php $this->load->view('header'); ?>

<!--MAIN-->

  <!-- Page Content -->
<div class="wrap-content wrap-content-app wrap-project">
    <div class="container">
        <div class="row">
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12  profile-user">
                <div class="col-lg-3 col-md-3 col-sm-3  avatar-user">
                    <div class="col-lg-12 col-md-12 col-sm-12">
                        <a class="thumbnail" href="#"><img class="img-responsive" src="<?php if($user_info['logo']!='') echo $user_info['logo'];else echo 'http://placehold.it/400x300'; ?>"></a>
                    </div>
                    <div class="arrow-up">
                    </div>
                    <div class="col-lg-12 col-md-12 col-sm-12  reviews">
                        <p class="col-lg-12 col-md-12 col-sm-12   x8-20-b">Khiếu nại</p>
                        <p class="col-lg-12 col-md-12 col-sm-12  x8-40-b">0/5</p>
                        <div class="col-lg-12 col-md-12 col-sm-12">
                            <input id="input-21e2" value="0" type="number" data-star-captions="{}" data-default-caption="{rating}" class="rating" min=0 max=5  data-size="xs" >
                        </div>
                        <p class="reviews-user xanh-15">( <?php echo $user_info['num_reviews']; ?> reviews)</p>
                        <p class="salary-user"><span class="x8-16">Thu nhập: </span><span class="x8-20-b">$5324</span></p>
                    </div>
                </div> <!-- avatar-user -->
                <div class="col-lg-9 col-sm-9 col-md-9 info-user">
                    <div class="name-user col-lg-12 col-md-12 col-sm-12 ">
                        <p class="x8-20-b"><?php echo $user_info['user_name'];?>
                            <!-- <span class="link-edit"><a href="#">Sửa</a></span> -->
                        </p>
                    </div> <!-- name-user -->
                    <div class="col-lg-12 col-md-12 col-sm-12  username">
                        <div class="col-lg-2  x8-16">
                            Username:
                        </div>
                        <div class="col-lg-10 x8-16">
                            <div id="update_username">
                                <?php echo $user_info['user_name'];?>
                                <span class="link-edit"><a href="/" id="edit_profile"> Edit</a></span>
                            </div>
                        </div>
                    </div> <!-- username -->
                    <div class="col-lg-12 col-md-12 col-sm-12  location-user">
                        <div class="col-lg-2 x8-16">
                            Location:
                        </div>
                        <div class="col-lg-10 x8-16">
                            <div id="update_location">
                                <?php echo $user_info['city'];?>
                                <span class="link-edit"><a href="/" id="edit_location"> Edit</a></span>
                            </div>
                        </div>
                    </div> <!-- location-user -->
                    <div class="col-lg-12 col-md-12 col-sm-12 intro-user x8-13">
                        <div id="update_description">
                            <?php echo $user_info['profile_desc'];?>
                            <span class="link-edit"><a href="/" id="edit_description"> Edit</a></span>
                        </div>                        
                    </div> <!-- intro-user -->
                    <div class="skill-resume-user col-lg-12">
                   
                        <div class="col-lg-6 skill-user">
                            <p class="x8-20-b">Kỹ năng</p>
                             <div id="show_add_skill">
                            <ul>
                            <?php
                            if($user_info['user_categories'] !=""){
                                $user_skill = explode(',', $user_info['user_categories']);
                                foreach ($user_skill as $skill) {
                                  //$url = base_url()."/index.php/users/delUserSkill/$skill";
                                    echo "<li><span> ".$skill."</span> <a href='/' id='del_skill'>Delete</a></li>";
                                }

                            }                                
                            ?>
                                <li><span><a href="/" id="addSkills">Thêm kỹ năng</a></span></li>
                            </ul>
                            </div>
                            <!-- <span><a href="/" id="addSkills">Thêm kỹ năng</a></span> -->
                        </div> <!-- skill-user -->
                    
                     
                        
                        <div class="col-lg-6 resume-user">
                            <p class="x8-20-b">Resume</p>
                            <ul>
                                <li>
                                    <span>Đại học Bách khoa</span>
                                    <a href="#">Delete</a>
                                </li>
                                <li>
                                    <span>Bằng B tiếng Anh</span>
                                    <a href="#">Delete</a>
                                </li>
                                <li>
                                    <span>Có kinh nghiệm làm web với PHP</span>
                                    <a href="#">Delete</a>
                                </li>
                                <li>
                                    <span>Javascript</span>
                                    <a href="#">Delete</a>
                                </li>
                                <li>
                                    <span><a href="#">Thêm kỹ năng</a></span>

                                </li>
                            </ul>
                        </div> <!-- resume-user -->
                    </div> <!-- skill-resume-user -->
                </div> <!-- info-user -->
            </div> <!-- profile-user -->
            <div class="Portfolio-user col-lg-12 col-md-12 col-sm-12">
                <h1 class="page-header logo-app logo-content-home">Portfolio</h1>
                <div class="content-2 col-lg-12 col-md-12 col-sm-12">
                    <div class="col-lg-3 col-md-4 col-xs-12 thumb">
                        <a href="#" class="thumbnail">
                            <img alt="" src="http://placehold.it/400x300" class="img-responsive">
                        </a>
                        <div class="details-item-home">
                           <div>App xem phim</div>
                        </div> <!-- details-item-home -->
                    </div> <!-- thumb -->
                    <div class="col-lg-3 col-md-4 col-xs-12 thumb">
                        <a href="#" class="thumbnail">
                            <img alt="" src="http://placehold.it/400x300" class="img-responsive">
                        </a>
                        <div class="details-item-home">
                           <div>Đọc báo</div>
                        </div> <!-- details-item-home -->
                    </div> <!-- thumb -->
                    <div class="col-lg-3 col-md-4 col-xs-12 thumb">
                        <a href="#" class="thumbnail">
                            <img alt="" src="http://placehold.it/400x300" class="img-responsive">
                        </a>
                        <div class="details-item-home">
                           <div>Nghe nhạc</div>
                        </div> <!-- details-item-home -->
                    </div> <!-- thumb -->
                    <div class="col-lg-3 col-md-4 col-xs-12 thumb">
                        <a href="#" class="thumbnail">
                            <img alt="" src="http://placehold.it/400x300" class="img-responsive">
                        </a>
                        <div class="details-item-home">
                           <div>Module</div>
                        </div> <!-- details-item-home -->
                    </div> <!-- thumb -->
                </div> <!-- content-2 -->
                <div class="add-portfolio col-lg-12 col-md-12 col-sm-12 x8-18">
                    <a href="#">Thêm dự án vào portfolio</a>
                </div> <!-- add-portfolio -->
                <div class="content-3-user col-lg-12 col-md-12 col-sm-12">
                    <h1 class="page-header logo-app logo-content-home">Feedback</h1>
                    <div class="content-feedback-user col-lg-12 col-md-12 col-sm-12">
                        <div class="col-lg-6 col-md-6 col-sm-6 content-left-feedback-user">
                            <div class="col-lg-6 col-md-6 col-sm-6 label-feedback x62-14-b">
                                Chất lượng công việc:
                            </div> <!-- label-feedback -->
                            <div class="col-lg-6 col-md-6 col-sm-6 rating-feedback">
                                <input id="input-feedback" value="0" type="number" data-star-captions="{}" data-default-caption="{rating}" class="rating" min=0 max=5  data-size="xs" >
                            </div> <!-- rating-feedback -->
                            <div class="col-lg-6 col-md-6 col-sm-6 label-feedback x62-14-b">
                                Trao đổi thông tin:
                            </div> <!-- label-feedback -->
                            <div class="col-lg-6 col-md-6 col-sm-6 rating-feedback">
                                <input id="input-feedback" value="0" type="number" data-star-captions="{}" data-default-caption="{rating}" class="rating" min=0 max=5  data-size="xs" >
                            </div> <!-- rating-feedback -->
                            <div class="col-lg-6 col-md-6 col-sm-6 label-feedback x62-14-b">
                                Chuyên môn nghiệp vụ:
                            </div> <!-- label-feedback -->
                            <div class="col-lg-6 col-md-6 col-sm-6 rating-feedback">
                                <input id="input-feedback" value="0" type="number" data-star-captions="{}" data-default-caption="{rating}" class="rating" min=0 max=5  data-size="xs" >
                            </div> <!-- rating-feedback -->
                            <div class="col-lg-6 col-md-6 col-sm-6 label-feedback x62-14-b">
                                Sẽ thuê lại nếu có dự án:
                            </div> <!-- label-feedback -->
                            <div class="col-lg-6 col-md-6 col-sm-6 rating-feedback">
                                <input id="input-feedback" value="0" type="number" data-star-captions="{}" data-default-caption="{rating}" class="rating" min=0 max=5  data-size="xs" >
                            </div> <!-- rating-feedback -->
                            <div class="col-lg-6 col-md-6 col-sm-6 label-feedback x62-14-b">
                                Tính chuyên nghiệp:
                            </div> <!-- label-feedback -->
                            <div class="col-lg-6 col-md-6 col-sm-6 rating-feedback">
                                <input id="input-feedback" value="0" type="number" data-star-captions="{}" data-default-caption="{rating}" class="rating" min=0 max=5  data-size="xs" >
                            </div> <!-- rating-feedback -->
                        </div> <!-- content-left-feedback-user -->
                        <div class="col-lg-6  col-md-6 col-sm-6 content-right-feedback-user">
                            <div class="col-lg-6 col-md-6 col-sm-6 label-feedback x62-14-b">
                                Tỷ lệ hoàn thành:
                            </div> <!-- label-feedback -->
                            <div class="col-lg-6 col-md-6 col-sm-6 label-feedback percent-feedback x62-14-b">
                                98%
                            </div> <!-- label-feedback -->
                            <div class="col-lg-6 col-md-6 col-sm-6 label-feedback x62-14-b">
                                Đúng ngân sách:
                            </div> <!-- label-feedback -->
                            <div class="col-lg-6 col-md-6 col-sm-6 label-feedback percent-feedback x62-14-b">
                                98%
                            </div> <!-- label-feedback -->
                            <div class="col-lg-6 col-md-6 col-sm-6 label-feedback x62-14-b">
                                Đúng thời hạn:
                            </div> <!-- label-feedback -->
                            <div class="col-lg-6 col-md-6 col-sm-6 label-feedback percent-feedback x62-14-b">
                                98%
                            </div> <!-- label-feedback -->
                            <div class="col-lg-12 col-sm-12 col-md-12 total-feedback x8-20-b">
                                <p>Tổng dự án đã tham gia : <span>5</span></p>
                            </div>
                        </div> <!-- content-right-feedback-user -->
                    </div> <!-- content-feedback-user -->
                </div> <!-- content-3-user -->
                <div class="comment-feedback content-4  col-lg-12 col-sm-12 col-md-12">
                    <div class="item-comment-feedback col-lg-12">
                        <div class="col-lg-2 col-sm-2 col-md-2 avatar-user col-xs-12">
                            <a class="thumbnail" href="#"><img class="img-responsive" src="http://placehold.it/400x300 "></a>
                        </div>
                        <div class="col-lg-10 col-sm-10 col-xs-12 col-md-10 right-comment-feedback">
                            <div class="col-lg-12">
                                <div class="col-lg-5 col-sm-5 col-md-5 x8-14-b col-xs-12">
                                    Nguyễn Ông Chủ
                                </div>
                                <div class="col-lg-2 col-sm-2 col-md-2 x8-14-b col-xs-12">
                                    $500
                                </div>
                                <div class="col-lg-5 col-sm-5 col-md-5 col-xs-12">
                                    <input id="input-feedback" value="0" type="number" data-star-captions="{}" data-default-caption="{rating}" class="rating" min=0 max=5  data-size="xs" >
                                </div>
                            </div>
                            <div class="arrow-feedback col-lg-1 col-sm-1 col-md-1 colxs-1"></div>
                            <div class="content-feedback col-lg-11 col-sm-11 col-md-11 col-xs-11">
                                <div class="col-lg-10 col-sm-10 col-md-10">  Làm tốt lắm con giai. </div>
                                <span class="time-feedback col-lg-2 col-sm-2 col-md-2">3 ngày trước</span>
                            </div> <!-- content-feedback -->
                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                I need someone to create an iOS app for my written idea that includes form filling and reminders. The app should be easily functional, not confusing, and professional. The person I want to work with should be one who keeps daily and convenient contact.
                            </div>
                        </div>
                    </div> <!-- item-comment-feedback -->
                    <div class="item-comment-feedback col-lg-12">
                        <div class="col-lg-2 col-sm-2 col-md-2 avatar-user col-xs-12">
                            <a class="thumbnail" href="#"><img class="img-responsive" src="http://placehold.it/400x300 "></a>
                        </div>
                        <div class="col-lg-10 col-sm-10 col-xs-12 col-md-10 right-comment-feedback">
                            <div class="col-lg-12">
                                <div class="col-lg-5 col-sm-5 col-md-5 x8-14-b col-xs-12">
                                    Nguyễn Ông Chủ
                                </div>
                                <div class="col-lg-2 col-sm-2 col-md-2 x8-14-b col-xs-12">
                                    $500
                                </div>
                                <div class="col-lg-5 col-sm-5 col-md-5 col-xs-12">
                                    <input id="input-feedback" value="0" type="number" data-star-captions="{}" data-default-caption="{rating}" class="rating" min=0 max=5  data-size="xs" >
                                </div>
                            </div>
                            <div class="arrow-feedback col-lg-1 col-sm-1 col-md-1 colxs-1"></div>
                            <div class="content-feedback col-lg-11 col-sm-11 col-md-11 col-xs-11">
                                <div class="col-lg-10 col-sm-10 col-md-10">  Làm tốt lắm con giai. </div>
                                <span class="time-feedback col-lg-2 col-sm-2 col-md-2">3 ngày trước</span>
                            </div> <!-- content-feedback -->
                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                I need someone to create an iOS app for my written idea that includes form filling and reminders. The app should be easily functional, not confusing, and professional. The person I want to work with should be one who keeps daily and convenient contact.
                            </div>
                        </div>
                    </div> <!-- item-comment-feedback -->
                    <div class="item-comment-feedback col-lg-12">
                        <div class="col-lg-2 col-sm-2 col-md-2 avatar-user col-xs-12">
                            <a class="thumbnail" href="#"><img class="img-responsive" src="http://placehold.it/400x300 "></a>
                        </div>
                        <div class="col-lg-10 col-sm-10 col-xs-12 col-md-10 right-comment-feedback">
                            <div class="col-lg-12">
                                <div class="col-lg-5 col-sm-5 col-md-5 x8-14-b col-xs-12">
                                    Nguyễn Ông Chủ
                                </div>
                                <div class="col-lg-2 col-sm-2 col-md-2 x8-14-b col-xs-12">
                                    $500
                                </div>
                                <div class="col-lg-5 col-sm-5 col-md-5 col-xs-12">
                                    <input id="input-feedback" value="0" type="number" data-star-captions="{}" data-default-caption="{rating}" class="rating" min=0 max=5  data-size="xs" >
                                </div>
                            </div>
                            <div class="arrow-feedback col-lg-1 col-sm-1 col-md-1 colxs-1"></div>
                            <div class="content-feedback col-lg-11 col-sm-11 col-md-11 col-xs-11">
                                <div class="col-lg-10 col-sm-10 col-md-10">  Làm tốt lắm con giai. </div>
                                <span class="time-feedback col-lg-2 col-sm-2 col-md-2">3 ngày trước</span>
                            </div> <!-- content-feedback -->
                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                I need someone to create an iOS app for my written idea that includes form filling and reminders. The app should be easily functional, not confusing, and professional. The person I want to work with should be one who keeps daily and convenient contact.
                            </div>
                        </div>
                    </div> <!-- item-comment-feedback -->
                    <div class="item-comment-feedback col-lg-12">
                        <div class="col-lg-2 col-sm-2 col-md-2 avatar-user col-xs-12">
                            <a class="thumbnail" href="#"><img class="img-responsive" src="http://placehold.it/400x300 "></a>
                        </div>
                        <div class="col-lg-10 col-sm-10 col-xs-12 col-md-10 right-comment-feedback">
                            <div class="col-lg-12">
                                <div class="col-lg-5 col-sm-5 col-md-5 x8-14-b col-xs-12">
                                    Nguyễn Ông Chủ
                                </div>
                                <div class="col-lg-2 col-sm-2 col-md-2 x8-14-b col-xs-12">
                                    $500
                                </div>
                                <div class="col-lg-5 col-sm-5 col-md-5 col-xs-12">
                                    <input id="input-feedback" value="0" type="number" data-star-captions="{}" data-default-caption="{rating}" class="rating" min=0 max=5  data-size="xs" >
                                </div>
                            </div>
                            <div class="arrow-feedback col-lg-1 col-sm-1 col-md-1 colxs-1"></div>
                            <div class="content-feedback col-lg-11 col-sm-11 col-md-11 col-xs-11">
                                <div class="col-lg-10 col-sm-10 col-md-10">  Làm tốt lắm con giai. </div>
                                <span class="time-feedback col-lg-2 col-sm-2 col-md-2">3 ngày trước</span>
                            </div> <!-- content-feedback -->
                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                I need someone to create an iOS app for my written idea that includes form filling and reminders. The app should be easily functional, not confusing, and professional. The person I want to work with should be one who keeps daily and convenient contact.
                            </div>
                        </div>
                    </div> <!-- item-comment-feedback -->
                    <div class="item-comment-feedback col-lg-12">
                        <div class="col-lg-2 col-sm-2 col-md-2 avatar-user col-xs-12">
                            <a class="thumbnail" href="#"><img class="img-responsive" src="http://placehold.it/400x300 "></a>
                        </div>
                        <div class="col-lg-10 col-sm-10 col-xs-12 col-md-10 right-comment-feedback">
                            <div class="col-lg-12">
                                <div class="col-lg-5 col-sm-5 col-md-5 x8-14-b col-xs-12">
                                    Nguyễn Ông Chủ
                                </div>
                                <div class="col-lg-2 col-sm-2 col-md-2 x8-14-b col-xs-12">
                                    $500
                                </div>
                                <div class="col-lg-5 col-sm-5 col-md-5 col-xs-12">
                                    <input id="input-feedback" value="0" type="number" data-star-captions="{}" data-default-caption="{rating}" class="rating" min=0 max=5  data-size="xs" >
                                </div>
                            </div>
                            <div class="arrow-feedback col-lg-1 col-sm-1 col-md-1 colxs-1"></div>
                            <div class="content-feedback col-lg-11 col-sm-11 col-md-11 col-xs-11">
                                <div class="col-lg-10 col-sm-10 col-md-10">  Làm tốt lắm con giai. </div>
                                <span class="time-feedback col-lg-2 col-sm-2 col-md-2">3 ngày trước</span>
                            </div> <!-- content-feedback -->
                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                I need someone to create an iOS app for my written idea that includes form filling and reminders. The app should be easily functional, not confusing, and professional. The person I want to work with should be one who keeps daily and convenient contact.
                            </div>
                        </div>
                    </div> <!-- item-comment-feedback -->
                </div> <!-- comment-feedback -->
                <div class="freelancer-pagination comment-pagination col-lg-12 col-md-12 col-sm-12">
                            <ul class="pagination">
                              <li class="disabled"><a href="#">Prev</a></li>
                              <li class="active"><a href="#">1 <span class="sr-only">(current)</span></a></li>
                              <li><a href="#">2</a></li>
                              <li><a href="#">3</a></li>
                              <li><a href="#">4</a></li>
                              <li><a href="#">5</a></li>
                              <li class="disabled"><a href="#">Next</a></li>
                            </ul>
                </div> <!-- freelancer pagination -->
            </div>
        </div> <!-- end row content -->
    </div>
</div> <!-- wrap-content -->

<script type="text/javascript">
        $(document).ready(function(){
            $("a#addSkills").click(function(e){
                e.preventDefault();
                 $("#myModal").modal('show');
                 $("#add_skill").click(function(){
                    $("#add_skill").unbind("click");
                    var url = '<?php echo base_url()?>index.php/users/do_addUserSkill';
                    var content = $("input#user_skill").val();
                    $.ajax({
                        type : "POST",
                        url : url,
                        data : "skill="+content,
                        beforeSend: function(){
                        <?php $img_url = base_url()."app/css/images/load.gif" ?>
                            $("#show_result").html("<img src='<?php echo $img_url;?>' />");
                        },
                        success:function(result){
                            var kq = jQuery.parseJSON(result);
                            if(kq['msg'] == true){
                                updateSkill();
                                $("#myModal").modal('hide');
                                $("input#user_skill").val('');
                                //$("#add_skill").unbind("click");
                             }else{
                                alert(kq['data']);
                                $("#myModal").modal('hide');
                             }
                           
                        },
                        complete:function(){
                            //$("#add_skill").unbind("click");
                        }
                    });// end ajax
                });// end add button click

            
            });
        // dùng cho đối tượng ảo do jquery tạo ra
        $(document).on('click','a#IaddSkills',function(e){
            e.preventDefault();
                 $("#myModal").modal('show');
                 $("#add_skill").click(function(){
                    $("#add_skill").unbind("click");
                    var url = '<?php echo base_url()?>index.php/users/do_addUserSkill';
                    var content = $("input#user_skill").val();
                    $.ajax({
                        type : "POST",
                        url : url,
                        data : "skill="+content,
                        beforeSend: function(){
                        <?php $img_url = base_url()."app/css/images/load.gif" ?>
                            $("#show_result").html("<img src='<?php echo $img_url;?>' />");
                        },
                        success:function(result){
                            var kq = jQuery.parseJSON(result);
                            if(kq['msg'] == true){
                                updateSkill();
                                $("#myModal").modal('hide');
                                $("input#user_skill").val('');
                                //$("#Iadd_skill").unbind("click");
                             }else{
                                alert(kq['data']);
                                $("#myModal").modal('hide');
                             }                           
                        },
                        complete:function(){
                            //$("#Iadd_skill").unbind("click");
                        }
                    });// end ajax
                });// end add button click
        });
        // update skill
        function updateSkill(){
            $.ajax({
                type : "GET",
                url : '<?php echo base_url()?>index.php/users/updateSkill',
                success:function(data){
                $("#show_add_skill").html(data);
            },  
            });
        }

        $("a#del_skill").click(function(e){
            e.preventDefault();
            //alert($(this).siblings().text());
            var name_skill = $(this).siblings().text();
            $("#myModalDeleteSkill").modal('show');
            $("#delete").click(function(){
                var url = '<?php echo base_url()?>index.php/users/delUserSkill';
                $.ajax({
                type: "POST",
                url: url,
                data: "name_skill="+name_skill,
                success:function(result){
                    var kq = jQuery.parseJSON(result);
                    if(kq['msg'] == true){
                        //location.reload();
                        $("#myModalDeleteSkill").modal('hide');
                        updateSkill();
                        
                    }else{

                    }
                },
                complete:function(){
                        //$("#delete").unbind("click");
                }                    
                });// end ajax
            });// end delete click
        });

        // dùng cho đối tượng ảo do jquery tạo ra
        $(document).on("click","a#Idel_skill",function(e){
            e.preventDefault();
            //alert($(this).siblings().text());
            var name_skill = $(this).siblings().text();
            $("#myModalDeleteSkill").modal('show');
            $("#delete").click(function(){
                var url = '<?php echo base_url()?>index.php/users/delUserSkill';
                $.ajax({
                type: "POST",
                url: url,
                data: "name_skill="+name_skill,
                success:function(result){
                    var kq = jQuery.parseJSON(result);
                    if(kq['msg'] == true){
                        $("#myModalDeleteSkill").modal('hide');
                        updateSkill();
                        
                    }else{

                    }
                },
                complete:function(){
                        //$("#delete").unbind("click");
                }                    
                });// end ajax
            });// end delete click
            
        });

        // function edit description
        $("a#edit_description").click(function(e){
            e.preventDefault();
            $("#myModalEditDescription").modal('show');
             $("button#update_description").click(function(){
                    var url = '<?php echo base_url()?>index.php/users/updateDescription';
                    var content = $("#description").val();
                    $.ajax({
                        type : "POST",
                        data : "description="+content,
                        url : url,
                        success:function(result){
                            var kq = jQuery.parseJSON(result);
                            if(kq['msg'] == true){
                                $("#myModalEditDescription").modal('hide');
                                reloadDescription();
                            }else{
                                $("#myModalEditDescription").modal('hide');
                                alert(kq['data']);
                            }
                        },
                    });//end ajax
                // end add button click
             });           
        });

        // dùng cho đối tượng ảo do jquery tạo ra
        $(document).on("click","a#edit_descriptions",function(e){
            e.preventDefault();
            $("#myModalEditDescription").modal('show');
             $("button#update_description").click(function(){
                    var url = '<?php echo base_url()?>index.php/users/updateDescription';
                    var content = $("#description").val();
                    $.ajax({
                        type : "POST",
                        data : "description="+content,
                        url : url,
                        success:function(result){
                            var kq = jQuery.parseJSON(result);
                            if(kq['msg'] == true){
                                $("#myModalEditDescription").modal('hide');
                                reloadDescription();
                            }else{
                                $("#myModalEditDescription").modal('hide');
                                alert(kq['data']);
                            }
                        },
                    });//end ajax
                // end add button click
             });  
        });

        function reloadDescription(){
            $.ajax({
                type : "GET",
                url : '<?php echo base_url()?>index.php/users/reloadDescription',
                success:function(data){
                $("#update_description").html(data);
            },  
            });
        }

        $("a#edit_profile").click(function(e){
            e.preventDefault();
            $("#myModalEditProfile").modal('show');
             $("button#update_username").click(function(){
                    var url = '<?php echo base_url()?>index.php/users/updateUsername';
                    var content = $("#username").val();
                    $.ajax({
                        type : "POST",
                        data : "username="+content,
                        url : url,
                        success:function(result){
                            var kq = jQuery.parseJSON(result);
                            if(kq['msg'] == true){
                                $("#myModalEditProfile").modal('hide');
                                reloadUsername();
                            }else{
                                $("#myModalEditProfile").modal('hide');
                                alert(kq['data']);
                            }
                        },
                    });//end ajax
                // end add button click
             });           
        });

        // dùng cho đối tượng ảo trong jquery
        $(document).on("click","a#edit_profiles",function(e){
            e.preventDefault();
            $("#myModalEditProfile").modal('show');
             $("button#update_username").click(function(){
                    var url = '<?php echo base_url()?>index.php/users/updateUsername';
                    var content = $("#username").val();
                    $.ajax({
                        type : "POST",
                        data : "username="+content,
                        url : url,
                        success:function(result){
                            var kq = jQuery.parseJSON(result);
                            if(kq['msg'] == true){
                                $("#myModalEditProfile").modal('hide');
                                reloadUsername();
                            }else{
                                $("#myModalEditProfile").modal('hide');
                                alert(kq['data']);
                            }
                        },
                    });//end ajax
                // end add button click
             }); 
        });// end

        // function reload username
        function reloadUsername(){
            $.ajax({
                type : "GET",
                url : '<?php echo base_url()?>index.php/users/reloadUsername',
                success:function(data){
                $("#update_username").html(data);
            },  
            });
        }

        // function edit location
        $("#edit_location").click(function(e){
            e.preventDefault();
            $("#myModalEditLocation").modal("show");
            $("button#update_location").click(function(){  
                var url = '<?php echo base_url()?>index.php/users/updateLocation';
                var content = $("#location").val();
                 $.ajax({
                    type : "POST",
                    data : "location="+content,
                    url : url,
                    success:function(result){
                        var kq = jQuery.parseJSON(result);
                        if(kq['msg'] == true){
                            $("#myModalEditLocation").modal('hide');
                            reloadLocation();
                            //reloadUsername();
                        }else{
                            $("#myModalEditLocation").modal('hide');
                            alert(kq['data']);
                        }
                    },
                });//end ajax

            });// end button click

        });// end edit location click

        // dùng cho đối tượng ảo do jquery tạo ra
        $(document).on("click","#edit_locations",function(e){
            e.preventDefault();
            $("#myModalEditLocation").modal("show");
            $("button#update_location").click(function(){  
                var url = '<?php echo base_url()?>index.php/users/updateLocation';
                var content = $("#location").val();
                 $.ajax({
                    type : "POST",
                    data : "location="+content,
                    url : url,
                    success:function(result){
                        var kq = jQuery.parseJSON(result);
                        if(kq['msg'] == true){
                            $("#myModalEditLocation").modal('hide');
                            reloadLocation();
                        }else{
                            $("#myModalEditLocation").modal('hide');
                            alert(kq['data']);
                        }
                    },
                });//end ajax

            });// end button click
        });

        // function reload location
        function reloadLocation(){
            $.ajax({
                type : "GET",
                url : '<?php echo base_url()?>index.php/users/reloadLocation',
                success:function(data){
                $("#update_location").html(data);
            },  
            });
        }

        
               
                
    });//end document ready
    </script>
    <!-- popup modal add skill-->
    <div class="modal fade" id="myModal">
        <div id="show_result"></div>
       <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            <h4 class="modal-title" id="myModalLabel">Add Skills</h4>
          </div>          
            <input type="text" name="user_skill" id="user_skill" class="form-control" placeholder="Skills separated by commas"/>
          
          <div class="modal-footer">
            <button type="button" class="btn btn-primary" id="add_skill">Add</button>
          </div>
        </div>
      </div>
    </div><!-- /.modal -->

    <!-- popup modal edit profile-->
    <div class="modal fade" id="myModalEditProfile">
        <div id="show_result"></div>
       <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            <h4 class="modal-title" id="myModalLabel">Edit Profile</h4>
          </div>          
            <input type="text" name="update_username" id="username" class="form-control" value="<?php echo $user_info['user_name'];?>" />          
          <div class="modal-footer">
            <button type="button" class="btn btn-primary" id="update_username">Save change</button>
          </div>
        </div>
      </div>
    </div><!-- /.modal -->


    <!-- popup modal delete skill-->
    <div class="modal fade" id="myModalDeleteSkill">
        <div id="show_result"></div>
       <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            <h4 class="modal-title" id="myModalLabel">Add Skills</h4>
          </div>
           <div class="modal-body">
            Are you sure want to delete this skill<b></b>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-primary" id="delete">Delete</button>
          </div>
        </div>
      </div>
    </div><!-- /.modal -->

    <!-- popup modal edit location -->
    <div class="modal fade" id="myModalEditLocation">
        <div id="show_result"></div>
       <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            <h4 class="modal-title" id="myModalLabel">Edit Location</h4>
          </div>          
            <input type="text" name="update_location" id="location" class="form-control" value="<?php echo $user_info['city'];?>" />          
          <div class="modal-footer">
            <button type="button" class="btn btn-primary" id="update_location">Save change</button>
          </div>
        </div>
      </div>
    </div><!-- /.modal -->

    <!-- popup modal edit description -->
    <div class="modal fade" id="myModalEditDescription">
        <div id="show_result"></div>
       <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            <h4 class="modal-title" id="myModalLabel">Edit Description</h4>
          </div>          
            <input type="text" name="update_description" id="description" class="form-control" value="<?php echo $user_info['profile_desc'];?>" />          
          <div class="modal-footer">
            <button type="button" class="btn btn-primary" id="update_description">Save change</button>
          </div>
        </div>
      </div>
    </div><!-- /.modal -->



<script src="<?php echo base_url() ?>/app/js/jquery-1.11.0.js"></script>
    <!-- Bootstrap Core JavaScript -->
    <script src="<?php echo base_url() ?>/app/js/bootstrap.js"></script>
    <script src="<?php echo base_url() ?>/app/js/star-rating.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        jQuery(document).ready(function () {
            $("#input-21e2").rating('refresh',{showCaption:true,defaultCaption:'0'});
            $(".rating").rating('refresh',{showCaption:true,clearCaption:'0'});
        });
    </script>
    


    
<!--END OF MAIN-->
<?php $this->load->view('footer'); ?>



